<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    /*

    */
    let obj = { name: "s", age: 25, city: "Beijing" };
    // const { name, age, city } = obj;
    // console.log(name, age, city); // s
    // let name, age, city;
    // ({ name, age, city } = obj);
    // console.log(name, age, city);
    let { address } = obj;
    console.log(address); //没有的值返回undefined

    // let { name = 12, age = 22, city = 33 } = obj; // 如果没有对象的属性，则返回默认值
    // console.log(name, age, city);

    obj = { name: "s", age: 25 };
    let { name: a = 12, age: b = 22, city: c = "e3默认值" } = obj; //设置别名 和默认值
    console.log(a, b, c);
    function fn() {
      //   "use strict"严格 模式的特点是不允许在函数内部重新声明变量，否则会报错。
      "use strict";
      var a = 10;
      a = 20;
      var a = 30;

      console.log(a); // 30
        
    }
    fn();
    
  </script>
</html>
